package com.tql.mall.cart.controller;

import com.tql.mall.cart.service.CartService;
import com.tql.mall.model.cart.CartInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: tyk
 * @Date: 2023/5/26 11:55
 * @Description:
 */
@RestController
@RequestMapping("api/cart/inner")
@Api(description = "service-cart对内暴露接口")
public class CartApiController {

    @Autowired
    private CartService cartService;

    /**
     * 获取选中的商品列表
     */
    @GetMapping("getCartCheckedList/{userId}")
    @ApiOperation("获取选中的商品列表")
    public List<CartInfo> getCartCheckedList(@PathVariable String userId) {
        return cartService.getCartCheckedList(userId);
    }

    /**
     * 删除选中的商品列表
     */
    @GetMapping("deleteCartCheckedList/{userId}")
    @ApiOperation("删除选中的商品列表")
    public void deleteCartCheckedList(@PathVariable String userId) {
        cartService.deleteChecked(userId);
    }
}
